package com.pwc.conversionTool.controller.sessionPersistence;

import javax.servlet.http.HttpSession;

import static com.pwc.conversionTool.controller.sessionPersistence.BaseSessionPersistence.*;

import com.pwc.conversionTool.entity.Account;

public class AccountSessionPersistence   {
	
	
	private final static String accountKey="account";
	static{
		
	}
	
	/**
	 * 
	 * @param session
	 * @return true: login,false:not login
	 */
	public static boolean isLogin(HttpSession session )
	{
			
		return !(null==session.getAttribute(accountKey));
	}
	
	public static void logOut(HttpSession session )
	{
		session.setAttribute(accountKey, null);
	}
	
	
	
	public static Account getCurrentAccount(HttpSession session)
	{
		return getTEntity(session,Account.class,accountKey);
	}
	
	public static void saveAccount(HttpSession session,Account account)
	{
		session.setAttribute(accountKey, account);
	}
	
	
	
}
